# -*- coding: utf-8 -*-
it = iter(range(6))
while True:
    try:
        x = next(it)
        print(x)
    except:
        # 遇到StopIteration就退出循环
        break